let xhr = new XMLHttpRequest();
xhr.onload = function(){
    if(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304){
        alert(JSON.stringify(xhr.responseText))
    } else {
        alert('request is unsuccessful '+ xhr.status)
    }
};
xhr.onprogress = function(event){
    let statusDom = document.getElementById('progress');
    if(event.lengthComputable){
        statusDom.innerHTML = "Received "+event.position + ' of '+event.totalSize + ' byte ';
    }
}
xhr.open('get','www.baidu.com',false);
xhr.send(null);